/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unipiloto.edu.co.auth.service.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author David
 */

@Entity
@Table(name = "REGISTERED_USER")
@NamedQueries({
    @NamedQuery(name = "User.findAll", query = "SELECT r FROM User r"),
    @NamedQuery(name = "User.findByUsername", query = "SELECT r FROM User r WHERE r.username = :username"),
    @NamedQuery(name = "User.findByPassword", query = "SELECT r FROM User r WHERE r.password = :password")})
public class User implements Serializable {

    @Id
    private String username;
    @Basic
    private String password;

    public User() {
    }

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public boolean passwordValidation(String password) {
        return this.password.equals(password);
    }
}
